cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)

# Set more strict compile warnings, the ROS defaults are:
#   -W -Wall -Wno-unused-parameter -fno-strict-aliasing
set(ROS_COMPILE_FLAGS -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing)

rosbuild_init()

#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

# Build NessieCore library
rosbuild_add_library(${PROJECT_NAME} src/ModuleCore.cpp src/ProcessWatcher.cpp src/Chrono.cpp
	src/ConfigWrapper.cpp src/LocalCoordConverter.cpp src/GlobalCoordConverter.cpp src/RandomNormal.cpp src/TimerMillis.cpp)

include($ENV{ROS_ROOT}/core/rosbuild/FindPkgConfig.cmake)
pkg_check_modules(CCGNU2 REQUIRED libccgnu2)
include_directories(${CCGNU2_INCLUDE_DIRS})
link_directories(${CCGNU2_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} ${CCGNU2_LIBRARIES})

rosbuild_add_executable(watchertest src/WatcherTest.cpp)
target_link_libraries(watchertest osl_core)

rosbuild_add_executable(corewatchertest src/CoreWatcherTest.cpp)
target_link_libraries(corewatchertest osl_core)

rosbuild_add_executable(timertest src/TimerTest.cpp)
target_link_libraries(timertest osl_core)

rosbuild_add_executable(chronotest src/ChronoTest.cpp)
target_link_libraries(chronotest osl_core)
